<html>
<head>
	<title>CS633 Group Project :: Team 1 :: Address Book</title>
	<link rel="stylesheet" href="css/style.css" type="text/css">
</head>
<body>
	<table width="100%">
		<!-- HEADER -->
		<tr style="padding:0px">
			<td><!--#include file ="header.asp"--></td>
		</tr>
		
		<!-- BODY -->
		<tr>
			<td align="center">
				<%
				'CONNECT TO DATABASE
				dbPath = "db/contacts.mdb"
				Set conn = Server.CreateObject("ADODB.Connection")
				MdbFilePath = Server.MapPath(dbPath)
				conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"
			
				'GENERATE AND EXECUTE QUERY
				SQL_stmt = "SELECT * FROM People"
				set RS = conn.execute(SQL_stmt)
				
				%>
				<table bgcolor=#990000 width=1000 cellpadding=5 cellspacing=1 border=0>
					<tr class="header">
						<td>Last Name
						<td>First Name
						<td>Address
						<td>City
						<td>State
						<td>Zip
						<td>Phone
						<td>E-mail
					<%
						'CYCLE THROUGH RECORDSETS AND DISPLAY THEM
						recordCount = 1
						While NOT RS.EOF
							lname = RS("LastName")
							fname = RS("FirstName")
							address = RS("StreetAddress")
							city = RS("City")
							state = RS("State")
							zip = RS("ZipCode")
							phone = RS("PhoneNo")
							email = RS("EmailAddress")
							If (recordCount = 1) Then
								rowColor = "oddrow"
								recordCount = 0
							Else
								rowColor = "evenrow"
								recordCount = 1
							End If
							%>
							<tr class=<%=rowColor%>>
								<td><%=lname%>
								<td><%=fname%>
								<td><%=address%>
								<td><%=city%>
								<td><%=state%>
								<td><%=zip%>
								<td><%=phone%>
								<td><%=email%>
							<%
							RS.MoveNext
						WEnd
					%>
				</table>
				<br/>
				<input type="button" onclick="history.go(-1);" value="&lt&lt Back" />
			</td>
		</tr>
		
		<!-- FOOTER -->
		<tr style="padding:0px">
			<td><!--#include file ="footer.asp"--></td>
		</tr>			
	</table>		
</body>